#ifndef CYCLONE_LEXER_BASE_H
#define CYCLONE_LEXER_BASE_H

#pragma once

#include <stack>

#include "antlr4-runtime.h"

namespace cyclone::parser
{
    class CycloneLexerBase : public antlr4::Lexer
    {
    public:
        CycloneLexerBase(antlr4::CharStream *input);
        virtual ~CycloneLexerBase();

        std::stack<bool> scopeStrictModes;

        bool lastToken = false;
        size_t lastTokenType = 0;

        bool useStrictDefault = false;
        bool useStrictCurrent = false;

        bool getStrictDefault();
        void setUseStrictDefault(bool value);
        bool IsStrictMode();
        virtual std::unique_ptr<antlr4::Token> nextToken() override;
        void ProcessOpenBrace();
        void ProcessCloseBrace();
        void ProcessStringLiteral();
        bool IsRegexPossible();
        bool IsInTemplateString();
        void IncreaseTemplateDepth();
        void DecreaseTemplateDepth();

    private:
        int templateDepth = 0;
    };

} // namespace cyclone::parser

#endif